Computer technology continues to advance at a rapid pace, with significant developments being made in both software and in the underlying hardware upon which the software executes. One significant advance in computer technology is the development of multi-processor computers, where multiple computer processors are interfaced with one another to permit multiple operations to be performed concurrently, thus improving the overall performance of such computers. Also, a number of multi-processor computer designs rely on logical partitioning to allocate computer resources to further enhance the performance of multiple concurrent tasks.
With logical partitioning, a single physical computer is permitted to operate essentially like multiple and independent virtual computers (referred to as logical partitions), with the various resources in the physical computer (e.g., processors, memory, and input/output devices) allocated among the various logical partitions. Each logical partition may execute a separate operating system, and from the perspective of users and of the software applications executing on the logical partition, operates as a fully independent computer.
A resource shared among the logical partitions, often referred to as a hypervisor or a partition manager, manages the logical partitions and facilitates the allocation of resources to different logical partitions. The system administrator (a human user or a component in the computer) can move resources from one partition to another in order to manage the workload across the various partitions. The movement of such resources is dynamic, i.e., it occurs without a reboot or re-IPL (Initial Program Load) of the impacted partitions. When a resource is moved from one partition (partition A) to another partition (partition B), the partition manager needs to ensure that partition A cannot access the resource after it has been removed from partition A. In order to accomplish this, the following sequences of operations are typically taken:
Partition A uses the resource via the following sequence:                a) A processor in partition A invokes the partition manager.        b) The partition manager verifies that partition A owns the resource.        c) The partition manager allows the processor in partition A to use the resource under the same invocation as step a).        
A resource is removed from partition A via the following sequence:                1) The system administrator asks partition A to give up a specific resource.        2) Partition A frees up the resource from an operating system perspective in partition A and invokes the partition manager on one of partition A's processors in order to notify the partition manager that partition A is giving up the resource. The partition manager, executing on a processor owned by the partition A, marks the resource as not in use, so that a subsequent attempt by partition A to use the resource fails.        3) The processor that marks the resource as not available checks the partition manager's other data structures to ensure that partition A is not using the resource. If the data structures indicate that the resource is in use, the call to free the resource fails. Otherwise the resource is freed and made available for use by the other partitions.        
A problem occurs with the above scenarios in that a race condition exists between them. To understand the race condition, consider the following example. When a processor P1 in partition A is between steps b) and c) attempting to obtain the use of the resource, another processor P2 also in the partition A is between steps 2) and 3) and frees the resource for the entire partition A. The processor P1 subsequently performs step c), causing the partition A to still be using the resource even though the partition manager has already given the resource to another partition B. If both the partition A and the partition B attempt to use the resource at the same time, errors or unpredictable results can occur. Thus, to solve this problem the partition manager needs to prevent this race condition, so that a malicious or errant partition cannot have access to a resource that it does not own.
One technique for addressing this problem is for the partition manager to use a global spin lock for both of the above sequences a-b-c and 1-2-3. A global spin lock is a simple but inefficient polling method where the process that is waiting for the lock to be unlocked does not accomplish any other work. This technique tends to have poor performance characteristics because of high contention for the cache line that contains the global spin lock.
Another technique for addressing this problem is for the partition manager to implement a spin lock on per-resource instance basis, that is, every resource has its own spin lock. While this technique yields better performance than does the global spin lock, it still can lead to cache line contention under performance sensitive calls to the partition manager for highly-used resources, and performance tends to be particular poor if a partition has a large number of processors.
Without a better way of allocating resources among logical partitions, the performance of logically-partitioned systems will continue to suffer.